The present invention relates to a video encoder and a video encoding method. More specifically, the present invention relates to a video encoder and a video encoding method by which picture frames are refreshed by inserting cyclically an intraframe-coded region into each of the picture frames.
A video codec (coder/decoder) has a problem that, when errors are mixed in bit streams in communication channels and storage systems, picture data cannot be decoded correctly, causing deterioration in picture quality. With low-bit-rate transmission channels and radio networks in particular, bit errors and cell loss are easy to occur. It is therefore required to increase error resilience.
There are some countermeasures against errors. One of the effective countermeasures is to refresh picture frames by inserting cyclically into the picture frames a picture region on which intraframe coding is performed. Such a picture region can be decoded independently of other frames and thus are not affected by errors mixed in bit streams in the other frames. Therefore, the use of the refresh method of inserting an intraframe coding picture region cyclically into each of picture frames allows the error resilience to be increased.
As a refresh method, a method called intraslice is known. For example, with MPEG-2 Video (ISO-IEC CD 13818-2), switching is made between intraframe coding mode (intra-mode) and interframe coding mode (intermode) in units of 16.times.16 pixels (macroblock). For example, an intraslice-based refresh method has been proposed by which, of a frame composed of vertical 30 macroblocks and horizontal 44 macroblocks, a region consisting of two macroblock lines (vertical two macroblocks.times.horizontal 44 macroblocks) is encoded in the intra-mode, the intraframe-encoded region is shifted by two lines every frame, and 15 frames form one cycle.
In this intraslice scheme, when a search is made for the motion vector associated with a macroblock present in a region above the intraframe-coded region of the current frame to be encoded, the search range from the previous frame serving as the reference frame is restricted and the search is not made from the un-refreshed region.
For example, the search of motion vectors for macroblocks in the current frame is restricted so that, of macroblocks in the previous frame, macroblocks in corresponding locations to the intraframe-coded region in the current frame are not included in the motion-vector search region. In the case of intraslice in which the direction of refresh is from top to bottom, therefore, all the motion vectors directed from bottom to top become restricted. Such restrictions allow frames to become refreshed completely by, at the worst, the (2 cycles-1)st frame from a frame in which errors have occurred and allow error propagation to converge.
For example, assume that the cycle of intraslice is four frames and errors have occurred in the entire bit stream in the first frame in one cycle of four frames. In this case, in coding a macroblock in an input frame in the inter-mode, only macroblocks which, of macroblocks in the reference frame, are present in the same location as and the region above that macroblock to be coded in the input frame are used for the motion vector search. Thus, the range through which the effects of errors propagate converges by the bottom most region in the frame.
The number of coded bits in the intra-mode is two times or more larger than that in the inter-mode when the same quantization parameters are used. Since there are constraints on transmission rates, the transmission rate of bit streams is required to be limited to a certain value or less. When the intraslice-based refresh scheme is used, therefore, it is required to reduce the number of coded bits by the amount corresponding to the intraslice to be inserted by making quantization parameters larger than in the case where no intraslice is inserted. However, this forms a serious cause of deterioration in picture quality.
Recently, as disclosed in Japanese Unexamined Patent Publication No. 9-247682 by way of example, several adaptive refresh schemes have been proposed which adaptively refresh only regions in a scene that have large motion to thereby reduce the insertion number of intra coding regions. For still regions having no motion, error concealment techniques can be employed by which corresponding regions in the previous frame are embedded into the current frame. Thus, by refreshing adaptively only regions that are large in motion, it becomes possible to effect a reduction in information content while maintaining the error resilience.
The conventional adaptive refresh schemes share a problem that the motion that intra-coded regions have in a scene are not considered.
That is, the conventional adaptive refresh schemes adopt the principle that, once a region is refreshed by an intra-coded region, it is not refreshed until new motion associated with that region is detected. Thus, once a region is coded in the intra mode, it is uniquely considered as a still region at that point and excluded from the refresh range until new motion associated with that region is detected.
For this reason, in the event that, when a scene change occurs and the picture is still after the scene change, intra-coded regions on the scene change frame drop out due to errors during transmission to the decoder, error-recovery is delayed, resulting a serious problem. This is illustrated in FIG. 11.
In FIG. 11, it is supposed that a scene change occurs at frame N+1 and there is no motion for a while in regions of macroblock MBi in succeeding frames. In general, the switching between coding modes, such as the intra mode and the inter mode, is made adaptively on a macroblock by macroblock basis according to the degree of temporal correlation in an input video signal. For example, when, like a scene change, a drastic change occurs in the picture, so that correlation between previous and current frames is lost completely, the intra mode is used. Thus, most of the macroblocks in the scene change frame N+1 are coded in the intra mode. When the conventional type of adaptive refresh is performed from top to bottom in a four-frame cycle from frame N+2, in frame N+2 the macroblock MBi is in its turn to be refreshed as shown. However, since the macroblock MBi is coded in the intra mode in previous frame N+1, the refresh of the macroblock MBi is inevitably skipped in frame N+2. In this case, the inter mode is chosen as the coding mode for the macroblock MBi in frame N+2. However, since there is no motion, the not-coded mode is actually used in which the corresponding macroblock in the previous frame is used for display without being coded.
After that, MBi's turn for refresh comes again in frame N+6. Unless motion is detected in the macroblock MBi by that time, the refresh of the macroblock is skipped in frame N+6 as well.
Thus, the macroblock MBi is not refreshed for a long time. If, therefore, the macroblock MBi in the scene change frame N+1 drops out due to transmission errors, correct information after scene change cannot be obtained for regions of the macroblock MBi, so that the picture in the previous frame N prior to the scene change is displayed as it is.
As described above, the conventional intraslice-based refresh scheme, which increases considerably the amount of coding, requires to make quantization parameters large in order to attain coding at the same rate, degrading the picture quality.
Moreover, with the adaptive refresh schemes to refresh only motion regions, since no refresh is performed for a while after scene change, error-recovery is delayed in the event that errors are mixed in the scene change frame, degrading the quality of displayed picture.
Furthermore, when the motion vector search range is restricted in order to ensure error-recovery by refresh, correct motion vectors cannot be found depending on the picture motion, degrading the picture quality.